//
// Created by tonystark on 16/3/22.
// Copyright (c) 2016 sewm. All rights reserved.
//

#import "BaseUITableViewController.h"


@implementation BaseUITableViewController {

}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self dataFactory];
}

#pragma mark base Action 

- (void)dataFactory {

}

/**
 * 注册CellClass
 */
- (NSArray *)registerClasses {
    return @[];
}

/**
 * 注册Header FooterClass
 */
- (NSArray *)registerHeaderFooterClasses {
    return @[];
}

#pragma mark Override TableView

- (UITableView *)tableView {
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        //注册Cell
        NSArray *registerClasses = [self registerClasses];
        if (registerClasses.count > 0) {
            for (Class aClass in registerClasses) {
                [_tableView registerClass:aClass forCellReuseIdentifier:NSStringFromClass(aClass)];
            }
        }
        //注册HeaderView
        NSArray *registerHeaderFooterClasses = [self registerHeaderFooterClasses];
        if (registerHeaderFooterClasses.count > 0) {
            for (Class aClass in registerHeaderFooterClasses) {
                [_tableView registerClass:aClass forHeaderFooterViewReuseIdentifier:NSStringFromClass(aClass)];
            }
        }

        [self.view addSubview:_tableView];
//        [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.top.equalTo(self.topView.mas_bottom);
//            make.bottom.equalTo(self.view.mas_bottom);
//            make.left.right.equalTo(self.view);
//        }];
    }
    return _tableView;
}


#pragma mark UITableView Delegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    return nil;
}

@end